﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

using RushTracker.Core;
using RushTracker.Core.Data;
using RushTracker.Core.Util;
using RushTracker.Core.Windsor;

namespace RushTracker.Web.UI
{
    public abstract class RushTrackerController : Controller, IDataAccessor
    {
        private IDataRepository _dataRepository;

        public RushTrackerController() { }

        public RushTrackerController(IDataRepository dataRepository)
        {
            this._dataRepository = dataRepository;
        }

        protected Site Site
        {
            get { return Site.Instance; }
        }

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            ViewData["Title"] = Site.Name + " - " + Site.Title;
        }

        public IDataRepository DataRepository
        {
            get { return this._dataRepository; }
            set { this._dataRepository = value; }
        }
    }
}
